﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows;

namespace Wpf树菜单项拖拽功能Demo
{
    public class TreeItem : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public string TextName { get; set; }

        /// <summary>
        /// 父节点
        /// </summary>
        public TreeItem Parent { get; set; }

        /// <summary>
        /// 子节点集合(若集合保持Null，则在new后，页面不会更新，所以初始化不为Null)
        /// </summary>
        public ObservableCollection<TreeItem> Childern { get; set; } = new ObservableCollection<TreeItem>();

        bool u_Add;
        public bool Add
        {
            get => u_Add;
            set
            {
                u_Add = value;
                if (PropertyChanged != null)
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Add"));
            }
        }
    }
        
}
